<template>
    <div class="topicInfoC"  >
      <div class="background">
        <img :src="require(`@/assets/imgs/yc/true.jpg`)" alt="">
      </div>
      <div class="item-bg active" ref="bg"></div>
      <swiper :options="swiperOption" ref="mySwiper" class="swiper">
        <swiper-slide v-for="(con,i) of source" :key="i">
          <div class="slideBox" ref="topicInfoC">
            <a href="#" class="news__item active" ref="news_item">
                  <div class="news-date">
                    <span class="news-date__title">24</span>
                    <span class="news-date__txt">八月</span>
                  </div>
                  <div class="news__title">
                    杨超越<br>创造10{{i}}
                  </div>

                  <p class="news__txt">
                    超越，1998年7月31日出生于江苏省盐城市大丰区，中国内地流行乐女歌手、影视演员，女子演唱组合CH2、火箭少女101成员。2017年，加入女子演唱组合CH2，从而正式出道。2018年，参加腾讯视频女团青春成长节目《创造101》，最终获得第3名，并加入女子演唱组合火箭少女101；同年，相继推出个人单曲《跟着我一起》、《冲鸭冲鸭》、《招财进宝》；12月15日，获得“影响中国”年度演艺人物奖
                  </p>

                  <div class="news__img">
                    <img :src="require(`@/assets/imgs/${1}.jpg`)" alt="news">
                  </div>
                </a>
          </div>
        </swiper-slide>
      </swiper> 
      <div class="svgbox">
        <div class="pagination" slot="pagination"></div>
      </div>
    </div>
</template>

<style scoped>
.topicInfoC {
  position: relative;
  overflow-x: hidden !important;
  font-family: sans-serif;
  border-radius: 5px;
}
a, a:hover {
  text-decoration: none;
}

.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  stroke-width: 0;
  stroke: currentColor;
  fill: currentColor;
}
.swiper {
  height: 650px;
}
.background {
  position: absolute;
  width: 100%;
  height: 100%;
  left: 0;
  top: 0;
}
.background:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(30deg, rgba(255, 255, 255, 0.6) 0%, #0E5DC4 100%);
  opacity: 0.9;
}
.background img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.item-bg {
  width: 400px;
  height: 500px;
  position: absolute;
  top: 30px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 26px 6px rgba(0, 0, 0, 0.25);
  opacity: 1;
  transition: all .3s;
  left: 30px;
}
.item-bg.active {
  left: 0;
  top: 0;
  opacity: 0;
}

.news-slider {
  z-index: 2;
  max-width: 1300px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 60px;
}
@media screen and (max-width: 1300px) {
  .news-slider {
    max-width: 1000px;
  }
}
@media screen and (max-width: 576px) {
  .news-slider {
    margin-top: 45px;
  }
}
.news-slider__wrp {
  display: flex;
  align-items: flex-start;
  position: relative;
  z-index: 2;
}
.news-slider__item {
  width: 400px;
  flex-shrink: 0;
}
@media screen and (max-width: 992px) {
  .news-slider__item {
    width: 340px;
  }
}
.news-slider__item.swiper-slide {
  opacity: 0;
  pointer-events: none;
  transition: all .3s;
}
.news-slider__item.swiper-slide-active, .news-slider__item.swiper-slide-prev, .news-slider__item.swiper-slide-next {
  opacity: 1;
  pointer-events: auto;
}
.news-slider__ctr {
  position: relative;
  z-index: 12;
}
.news-slider__arrow {
  background: #fff;
  border: none;
  display: inline-flex;
  width: 50px;
  height: 50px;
  justify-content: center;
  align-items: center;
  box-shadow: 0 6px 26px 6px rgba(0, 0, 0, 0.25);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  z-index: 12;
  cursor: pointer;
  outline: none !important;
}
.news-slider__arrow:focus {
  outline: none !important;
}
.news-slider__arrow .icon-font {
  display: inline-flex;
}
.news-slider__arrow.news-slider-prev {
  left: 15px;
  transform: translateY(-50%);
}
.news-slider__arrow.news-slider-next {
  right: 15px;
  transform: translateY(-50%);
}
.news-slider__pagination {
  text-align: center;
  margin-top: 50px;
}
.news-slider__pagination .swiper-pagination-bullet {
  width: 13px;
  height: 10px;
  display: inline-block;
  background: #fff;
  opacity: .2;
  margin: 0 5px;
  border-radius: 20px;
  transition: opacity .5s, background-color .5s, width .5s;
  transition-delay: .5s, .5s, 0s;
}
.news-slider__pagination .swiper-pagination-bullet-active {
  opacity: 1;
  background: #ffffff;
  width: 100px;
  transition-delay: 0s;
}
@media screen and (max-width: 576px) {
  .news-slider__pagination .swiper-pagination-bullet-active {
    width: 70px;
  }
}
.news__item {
  padding: 40px;
  color: #fff;
  border-radius: 10px;
  display: block;
  transition: all .3s;
}
@media screen and (min-width: 800px) {
  .news__item:hover {
    color: #222222;
    transition-delay: .1s;
  }
  .news__item:hover .news-date, .news__item:hover .news__title, .news__item:hover .news__txt {
    opacity: 1;
    transition-delay: .1s;
  }
  .news__item:hover .news__img {
    box-shadow: none;
  }
}
.news__item.active {
  color: #222222;
}
.news__item.active .news-date, .news__item.active .news__title, .news__item.active .news__txt {
  opacity: 1;
}
.news__item.active .news__img {
  box-shadow: none;
}
@media screen and (max-width: 992px) {
  .news__item {
    padding: 30px;
  }
}
@media screen and (max-width: 576px) {
  .news__item {
    padding: 20px;
  }
}
.news-date {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 2px solid;
  display: inline-block;
  opacity: .7;
  transition: opacity .3s;
}
@media screen and (max-width: 576px) {
  .news-date {
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    padding-bottom: 0;
  }
}
.news-date__title {
  display: block;
  font-size: 32px;
  margin-bottom: 10px;
  font-weight: 500;
}
@media screen and (max-width: 576px) {
  .news-date__title {
    margin-right: 10px;
  }
}
.news-date__txt {
  font-size: 16px;
}
.news__title {
  font-size: 25px;
  font-weight: 500;
  opacity: .7;
  margin-top: 10px;
  margin-bottom: 15px;
  transition: opacity .3s;
}
@media screen and (max-width: 576px) {
  .news__title {
    font-size: 22px;
    margin-bottom: 10px;
  }
}
.news__txt {
  margin: 10px 0;
  line-height: 1.6em;
  font-size: 15px;
  opacity: .7;
  transition: opacity .3s;
  overflow: hidden;
  text-overflow: ellipsis;
  /* white-space: nowrap; */
  height: 90px;
}
.news__img {
  border-radius: 10px;
  box-shadow: 0 6px 26px 6px rgba(0, 0, 0, 0.25);
  height: 200px;
  margin-top: 30px;
  width: 100%;
  transition: all .3s;
  transform-origin: 0% 0%;
}
@media screen and (max-width: 576px) {
  .news__img {
    height: 180px;
    margin-top: 20px;
  }
}
.news__img img {
  max-width: 100%;
  border-radius: 10px;
  height: 100%;
  width: 100%;
}
#icon{
  display:none;
}
</style>

<style scoped>
.svgbox {
  height: 40px;
  line-height: 40px;
  width: 100%;
  /* background-color: orange; */
  position: absolute;
  bottom: .5rem;
  text-align: center;
}

</style>
<script>
export default {
    data(){
        return {
            swiperOption: {
              slidesPerView: 3,
              paginationClickable: true,
              spaceBetween: 30,
              itemWidth: 30,
              loop:true,
              effect : 'coverflow',
              centeredSlides: true,
              coverflowEffect: {
                rotate: 30,
                stretch: 10,
                depth: 60,
                modifier: 2,
                slideShadows : true
              },
              pagination: {
                el: '.pagination',
              }
            },
            // 请求的内容
            source:[
              {},
              {},
              {},
              {},
              {},
              {}
            ]
        }
    },
    computed: {
      swiper() {
        return this.$refs.mySwiper.swiper
      }
    },
    mounted() {
      this.$refs.bg.style=`left:${400}px;opacity:1`
    },
    methods:{
      handleMousemove(i,e){
        // 获取页面宽度 高度
        let width=this.$refs.topicInfoC[i].offsetWidth;
        let height=this.$refs.topicInfoC[i].offsetHeight;
        let w=400;
        let x=e.offsetX;
        let y=e.pageY;
        console.log('i',i)
        this.$refs.bg.style=`left:${w*i}px;opacity:1`;
          this.$refs.news_item.forEach((item)=>{
            item.className="news__item"
          })
          this.$refs.news_item[i].className="news__item active"
          if(y>1500){
            this.$refs.bg.style=`left:${w*i}px;opacity:1;height:610px`;
          }
        this.itemWidth=width;

        
      },
      handleMouseout(i){
        this.$refs.bg.style=`left:${this.itemWidth}px;opacity:1`
        this.$refs.news_item[0].className="news__item"
        this.$refs.news_item[1].className="news__item active"
        this.$refs.news_item[2].className="news__item"
      }
    }
}
</script>